
<template>
  <div class="city">
    <div class="mycity">
      我的城市：&nbsp;&nbsp;<span id="qyxs"
            class="cityname">{{city}}</span>
    </div>
    <w-sortlist v-model="listData"
                value=""
                @click="select"
                children="cities"
                relkey="core"
                label="name"></w-sortlist>
  </div>
</template>
<script>
import wSortlist from 'wenlist'
import * as API from '../../api'
export default {
  name: 'wSortListDemoVue',
  components: {
    wSortlist
  },
  data () {
    return {
      listData: [
      ]
    }
  },
  created () {
    this.city = this.$route.query.city
    this.$http.get(API.city_lsit).then(res => {
      this.listData = res.data
      console.log(res.data)
    })
      .catch(err => {
        console.log(err)
      })
  },

  methods: {
    select (data) {
      console.log(data.name)
      this.$router.push({ path: '/', query: { city: data.name } })
    }
  }
}
</script>
<style scoped lang="scss">
@import "../../assets/style/index.scss";
</style>
